﻿namespace ImageManager.ImageApi
{
    [Serializable]
    public class ResponseData<T>
    {
        public ResponseData()
        {
            SystemCode = SystemCodeEnum.Success;
            Message = "操作成功";
        }
        public ResponseData(IEnumerable<T> data)
        {
            SystemCode = SystemCodeEnum.Success;
            Message = "操作成功";
            Data = data;
        }
        public ResponseData(T data)
        {
            SystemCode = SystemCodeEnum.Success;
            Message = "操作成功";
            Data = new List<T>() { data };
        }
        int totalCount;
        public SystemCodeEnum SystemCode { get; set; }
        public IEnumerable<T> Data { get; set; }
        public int TotalCount
        {
            get { return totalCount == 0 ? Count : totalCount; }
            set { totalCount = value; }
        }
        public int Count
        {
            get { return Data != null ? Data.Count() : 0; }
        }
        public string Message { get; set; }
    }
    public enum SystemCodeEnum
    {
        Success, Error,TokenError
    }
}
